package Lotr.game.Entity;

import Lotr.game.Entity.EnemyTypes.*;
import Lotr.game.Path;
import Lotr.game.Resources;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List;

public class Enemies {

    private List<Enemy> enemies;
    private Resources res;

    public Enemies(Resources res) {
        enemies = new ArrayList<Enemy>();
        this.res = res;
    }

    public void addEnemy(int enemyType, Path path) {
        if (enemyType == Enemy.TROLL) {
            enemies.add(new Troll(path, res));
        } else if (enemyType == Enemy.DRAGON) {
            enemies.add(new Dragon(path, res));
        } else if (enemyType == Enemy.ORK) {
            enemies.add(new Ork(path, res));
        } else if (enemyType == Enemy.URUK) {
            enemies.add(new Uruk(path, res));
        } else if (enemyType == Enemy.WARG) {
            enemies.add(new Warg(path, res));
        }
    }

    //Renders all enemies
    public void render(Graphics g) {
        //Reason that not a foreach loop is used:
        //Synchronizing
        for (int i = 0; i < enemies.size(); i++) {
            enemies.get(i).render(g);
        }
    }

    public void update() {
        for (int i = 0; i < enemies.size(); i++) {
            enemies.get(i).update();
        }
    }

    public void removeEnemy(Enemy e) {
        //enemies.remove(e);
    }
}
